<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算属性</title>
</head>

<body>
    <!--view层模板-->
    <div id="vue">
        <p>currentTime1 {{currentTime1()}}</p>
        <p>currentTime2 {{currentTime2}}</p>
    </div>
    <!--导入Vue.js-->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var vm = new Vue({
            el: "#vue",
            methods: {
                currentTime1: function () {
                    return Date.now();//返回一个时间戳
                }
            },
            computed: {//计算属性：methods,computed 方法名不能重名，重名之后，只会调用methods的方法
                currentTime2: function () {
                    return Date.now();//返回一个时间戳
                }
            }
        });
    </script>
</body>

</html>